n, m = map(int, input().split())
from collections import defaultdict

graph = defaultdict(list)
for _ in range(m):
    u, v, w = map(int, input().split())
    graph[u] = [v, w]
k = int(input())
reset = list(map(int, input().split()))
